<%@ page import="java.util.ArrayList" %>
<%@ page import="employee.Employee" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 王宇航
  Date: 2023/3/9
  Time: 11:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Admin_Index</title>
    <script>
        function del(){
            return confirm("delect this is truth!");
        }
    </script>
</head>
<body>
<h1 style="color: aquamarine">${sessionScope.username}</h1>
<hr>
<a href="addemployee.jsp">add employee</a>
<table border="1">
    <tr>
        <th>Id</th>
        <th>name</th>
        <th>email</th>
        <th>age</th>
        <th>gender</th>
        <th colspan="2">operation</th>
    </tr>
       <c:forEach var="employee" items="${sessionScope.employees}">
           <tr>
               <td>${employee.id}</td>
               <td>${employee.name}</td>
               <td>${employee.email}</td>
               <td>${employee.age}</td>
               <td>${employee.gender}</td>
               <td><a href="/employee?action=editer&id=${employee.id}">Editer</a></td>
               <td><a href="/employee?action=remove&id=${employee.id}" onclick="return del()">Remove</a></td>
           </tr>
       </c:forEach>
</table>
<hr>
<a href="/employee?action=signout">Sign Out</a>
<p style="color: green">${sessionScope.message}</p>
</body>
</html>
